/*
 * =====================================================================================
 *
 *       Filename:  eventHandler.h
 *
 *    Description:  abstract class for event handler
 *
 *        Version:  1.0
 *        Created:  07/13/2012 03:08:38 PM
 *       Revision:  none
 *       Compiler:  gcc/g++
 *
 *         Author:  wangtengchao , wangtengchao AT gmail.com
 *   Organization:  
 *
 * =====================================================================================
 */
#ifndef EVENTHANDELR_H
#define EVENTHANDELR_H
#include "defines.h"

#include <boost/noncopyable.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/enable_shared_from_this.hpp>
namespace inm
{
	namespace net
	{
        class Dispatcher;
        class EventHandler : boost::noncopyable
		{
			public:

                virtual ~EventHandler(){}
                virtual void handleRead(){}
                virtual void handleWrite(){}
                virtual void handleClose(){}
                virtual void handleTimeout(){}
               // virtual Socket getSocketHandle() = 0;
                virtual  int getSocketFdHandle() const= 0;
                short getCurrentEventTypes() const{return eventType_;}
                void setName(const std::string& s){name_ = s;}
                std::string getName() const {return name_;}
                void setCurrentEventTypes(short type){eventType_ = type;}
            protected:
                EventHandler(std::string name,Dispatcher* dispatcher):
                    name_(name),
                    dispatcher_(dispatcher){}
                short  eventType_;//record the current event types. add for disptcher's UpdateEventHandler
                Dispatcher* dispatcher_;
                //record info about tcp ---fromIp  port id
                //format : fromIp#port#id
                std::string name_;
        };

	};
};
#endif
